<?php

//Despite how it sounds, this isnt good.
Class MagicException extends Exception{

	function classLoadError()
	{
		$fail = "
			Please make sure the class exists and there are no spelling mistakes in the name.
			<br /><br />
			Class at '{$this->getMessage()}' could not be found.
			<br /><br />
			<strong>Call to Class made at:</strong><br />
		";
		
		die($this->format('Class not found',$fail));
	}
	
	
	function accessError(){
		$fail = "
			Call has been made '{$this->getMessage()}' method from none authenticated user.
			<br /><br />
			<strong>Debug</strong><br />
		";
		die($this->format('Method Access Exception',$fail));
	}
	
	function highRiskActionException(){
		$fail = "{$this->getMessage()} 
			<br /><br />
			<strong>Call to method made from:</strong><br />
		";
		die($this->format('Method Disallowed',$fail));
	}
	
	function databaseLimitation(){
		$fail = "{$this->getMessage()} 
			<br /><br />
			<strong>Action called from:</strong><br />
		";
		die($this->format('Action not supported',$fail));
	}
	function format($title,$text){
		$newtext = "
		<div style='width:50%;margin:auto;border:solid 1px;'>
			<div style='color:white;background-color:black;padding:4px;font-weight:bold;'>{$title}</div>
			<div style='padding:5px;'>
				{$text}
				
				Line: {$this->getLine()}<br />
				File: {$this->getFile()}
			</div>
		</div>
		";
		return $newtext;
	}
	
	
	
	
}

	